package cn.edu.uestc.cwdsj.controller;

import cn.edu.uestc.cwdsj.service.TestService;
import cn.edu.uestc.framework.ajax.AjaxResponse;
import com.google.gson.Gson;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;

/**
 * 测试异常封装的controller
 * Created by Eric on 2017/6/12.
 */
@Controller
public class TestController {
    @Resource
    private TestService testService;
    @Resource
    private Gson gson;

    @RequestMapping(value = "/xcodemap", method = RequestMethod.GET)
    @ResponseBody
    public String getXCodeMapList() {
        return gson.toJson(AjaxResponse.getOKResponse(gson.toJson(testService.getXCodeMapList())));
    }

    @RequestMapping("/")
    @ResponseBody
    public String testIsServerOk() {
        return "server is ok";
    }
}
